package com.dongdongshop.service.impl;

import com.dongdongshop.mapper.TbAdminMapper;
import com.dongdongshop.pojo.TbAdmin;
import com.dongdongshop.pojo.TbAdminExample;
import com.dongdongshop.service.AdminService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@DubboService
@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    private TbAdminMapper tbAdminMapper;

    @Override
    public TbAdmin selectByName(String username) {
        TbAdminExample example = new TbAdminExample();
        TbAdminExample.Criteria criteria = example.createCriteria();
        criteria.andNameEqualTo(username);
        List<TbAdmin> tbAdmins = tbAdminMapper.selectByExample(example);
        return tbAdmins.size()>0?tbAdmins.get(0):null;
    }
}
